<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>分润管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出分润数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/pay/profit/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/pay/profit/list");
			$("#searchForm").submit();
	    	return false;
	    }
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/pay/profit/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/pay/profit/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/pay/profit/list">分润列表</a></li>
		<li><a href="${ctx}/pay/profit/form">分润添加</a></li>
		<li><a href="${ctx}/pay/profit/sum">分润汇总</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="profitData" action="${ctx}/pay/profit/list" method="post" class="breadcrumb form-search ">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<ul class="ul-form">
			<li><label>会员名：</label><form:input path="userName" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li><label>平台：</label><%-- <form:input path="platformName" htmlEscape="false" maxlength="50" class="input-medium"/> --%>
				<form:select path="platformCode" class="input-large required">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('profit_platform')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="clearfix"></li>
			<li><label>年份：</label>
				<form:select path="issueYear" class="input-medium">
					<form:option value="" label="请选择" selected="selected"/>
					<c:forEach items="${years}" var="year">
						<c:if test='${year eq currentYear}'><form:option value="${year}" label="${year}" selected="selected"/></c:if>
						<c:if test='${year ne currentYear}'><form:option value="${year}" label="${year}"/></c:if>
					</c:forEach>
					<%-- <form:options items="${years}" itemLabel="label" itemValue="value" htmlEscape="false"/> --%>
				</form:select>
			</li>
			<li><label>&nbsp;月份：</label>
				<form:select path="issueMonth" class="input-medium">
					<form:option value="" label="请选择" selected="selected"/>
					<c:forEach items="${months}" var="month">
						<c:if test='${month eq currentMonth}'><form:option value="${month}" label="${month}" selected="selected"/></c:if>
						<c:if test='${month ne currentMonth}'><form:option value="${month}" label="${month}"/></c:if>
					</c:forEach>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
				<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
				<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th class="sort-column name">年份</th>
				<th class="sort-column name">月份</th>
				<th class="sort-column login_name">会员名</th>
				<th class="sort-column name">平台</th>
				<th class="sort-column name">会员代号</th>
				<th class="sort-column name">手机号</th>
				<th class="sort-column name">上级机构代码</th>
				<th class="sort-column name">金额</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="profitData">
			<tr>
				<td>${profitData.issueYear}</td>
				<td>${profitData.issueMonth}</td>
				<td><a href="${ctx}/pay/profit/form?id=${profitData.id}">${profitData.platformUserName}</a></td>
				<td>${profitData.platformName}</td>
				<td>${profitData.platformUserCode}</td>
				<td>${profitData.platformUserPhone}</td>
				<%-- <td>${profitData.superiorPlatformName}</td> --%>
				<td>${fns:getDictLabel(profitData.platformCode, 'profit_platform', '')}</td>
				<td>${profitData.amount}</td>
				<td>
    				<a href="${ctx}/pay/profit/form?id=${profitData.id}">修改</a>
					<a href="${ctx}/pay/profit/delete?id=${profitData.id}" onclick="return confirmx('确认要删除该用户分润记录吗？', this.href)">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>